diag_log Format["TeamSwitch: %1",switchableUnits];
_units = switchableUnits;
{ if (side _x != d_side_enemy) then { removeSwitchableUnit _x; };
} foreach _units;
_units = switchableUnits;
diag_log Format["TeamSwitch: %1",allUnits];
if (count allUnits > 0) then {
	{ 
		diag_log Format["TeamSwitch: %1",[_x, typeof _x, side _x, d_side_enemy, (_x in _units)]];
		if (_x iskindof "Man") then {
			if (side _x == d_side_enemy) then {
				if (!(_x in _units)) then {
					_units set [count _units, _x];
					diag_log Format["TeamSwitch: %1",[_x, typeof _x, "Added"]];
				};
			};
		};
	} foreach allUnits;
};
if (!(player in _units)) then {
	_units set [count _units, player];
};
switchableUnits = _units;
diag_log Format["TeamSwitch: %1",switchableUnits];
teamSwitch;
